﻿using MessagePack;
using System;
using System.Runtime.InteropServices;

namespace CCManger.Common.Message
{
    /// <summary>
    /// 发送消息的封装
    /// </summary>
    [MessagePackObject]
    public class Message : IMessage
    {
        /// <summary>
        /// 基础命令
        /// </summary>
        [Key(0)] //排序
        public COMMAND Command { get; set; }
        /// <summary>
        /// 协议里的操作内容
        /// </summary>
        [Key(1)]
        public Operation Eoperation { get; set; }
        /// <summary>
        /// 协议里的操作内容
        /// </summary>
        [Key(2)]
        public SenderInfo SenderInfo { get; set; }
        [Key(3)] //排序
        public string Content { get; set; }
    }


    /// <summary>
    /// 发送消息的封装
    /// </summary>
    [MessagePackObject]
    public class SenderInfo
    {
        /// <summary>
        /// ID
        /// </summary>
        [Key(0)] 
        public string ID { get; set; }
        /// <summary>
        /// 名字
        /// </summary>
        [Key(1)]
        public string Name { get; set; }

        [Key(2)]
        public string MachineName { get; set; }

        [Key(3)]
        public string OSVersion { get; set; }

        [Key(4)]
        public string UserName { get; set; }

        [Key(5)]
        public long WorkingSet { get; set; }

        public SenderInfo()
        {
            MachineName = Environment.MachineName;
            OSVersion = Environment.OSVersion.ToString();
            UserName = Environment.UserName;
            WorkingSet = Environment.WorkingSet;
        }

    }
}